<?php
/* @var $this BackendController */
/* @var $model Category */

$this->breadcrumbs=array(
    Yii::t('CategoryModule.base','Categories')=>array('index'),
    Yii::t('CategoryModule.base','Manage'),
);

$this->menu=array(
	array('label'=>'<span class="glyphicon glyphicon-list"></span>&nbsp'.Yii::t('CategoryModule.base','List Category'), 'url'=>array('index')),
	array('label'=>'<span class="glyphicon glyphicon-plus"></span>&nbsp'.Yii::t('CategoryModule.base','Create Category'), 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#category-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h3><?php echo Yii::t('CategoryModule.base','Manage Categories')?></h3>

<p>
    <?php echo Yii::t('CategoryModule.base','You may optionally enter a comparison operator')?> (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
    <?php echo Yii::t('CategoryModule.base','or')?> <b>=</b>) <?php echo Yii::t('CategoryModule.base','at the beginning of each of your search values to specify how the comparison should be done.')?>
</p>

<?php echo CHtml::link(Yii::t('CategoryModule.base','Advanced Search'),'#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'category-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
    'pager' => array('cssFile' => Yii::app()->theme->baseUrl . '/assets/gridview/pager.css'),
    'baseScriptUrl'=>Yii::app()->theme->baseUrl.'/assets/gridview',
	'columns'=>array(
        array(
            'name' => 'id',
            'type' => 'raw',
            'htmlOptions' => array('style'=>'width:50px'),
        ),
        array(
            'name' => 'name',
            'type' => 'raw',
            'htmlOptions' => array('style'=>'width:200px'),
        ),
        array(
            'name'=>'create_time',
            'type'=>'raw',
            'value'=>'$data->getCreateDateTimeFormat()',
            'htmlOptions' => array('style'=>'width:180px'),
        ),
        array(
            'name'=>'update_time',
            'type'=>'raw',
            'value'=>'$data->getUpdateDateTimeFormat()',
            'htmlOptions' => array('style'=>'width:180px'),
        ),
        array(
            'name'=>'create_user_id',
            'type'=>'raw',
            'value'=>'$data->createUser->name', // =>если пустое значение create_user_id -'CHtml::value($data, "createUser.name");'
             'htmlOptions' => array('style'=>'width:150px'),
        ),
        array(
            'name'=>'record_counts',
            'type'=>'raw',
            'value'=>'$data->getRecordCount()',
            'htmlOptions' => array('style'=>'width:100px'),
        ),
		/*
		'update_user_id',
		*/
		array(
			'class'=>'CButtonColumn',
            'htmlOptions' => array('style'=>'width:100px'),
		),
	),
)); ?>
